Skip to content

[DataGrid] Add missing slotProps to panel interface#22651

Open
cherniavskii wants to merge 6 commits into
mui:masterfrom
cherniavskii:add-missing-panel-slotProps
Open

[DataGrid] Add missing slotProps to panel interface#22651
cherniavskii wants to merge 6 commits into
mui:masterfrom
cherniavskii:add-missing-panel-slotProps

Conversation

@cherniavskii

@cherniavskii cherniavskii commented Jun 1, 2026

Copy link
Copy Markdown
Member

While creating a customization recipe for a support request, I noticed that some props are being passed in runtime but are missing in TS interface (e.g. placement).
I've updated the interface to reflect what is actually being passed in runtime.

I've also added a customization demo that mimics the default v7 behavior (this is what the support request was about).

Preview: https://deploy-preview-22651--material-ui-x.netlify.app/x/react-data-grid/filtering/customization/#customize-the-filter-panel-position

@cherniavskii cherniavskii added type: bug It doesn't behave as expected. scope: data grid Changes related to the data grid. labels Jun 1, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Jun 1, 2026

Copy link
Copy Markdown

Deploy preview

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

}

export default function CustomFilterPanelPosition() {
export default function CustomFilterPanelPositionNoSnap() {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this demo customizes the panel placement that is not visible when the screenshot is taken, I've excluded it from being screenshoted.

@siriwatknp siriwatknp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for taking care of this, here is what I found:

  1. The switch to Omit<GridSlotProps['basePopper'], 'ref'> also exposes the internal on* handlers as settable, which can break the panel. Suggest keeping Pick and only adding placement + safe booleans like focusTrap.
  2. open: boolean re-declaration in GridPanelProps is now redundant, since PopperProps already requires it.

GridSlotProps['basePopper'],
'id' | 'className' | 'target' | 'flip'
> {
export interface GridPanelProps extends Omit<GridSlotProps['basePopper'], 'ref'> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(1) This widening exposes the on* handlers (onDidShow, onDidHide, onClickAway, and the clickAway*Event props) through slotProps.panel, but they are controlled internally.

The {...other} spread runs after onDidShow={onDidShow}, so a consumer override stops setIsPlaced(true) from firing. Then {isPlaced && children} never renders the panel content. Same path breaks onClickAway and onDidHide.

I think it is safer to keep the existing Pick and only add props with a clear use case. placement is the real motivation here, and boolean toggles like focusTrap are safe because they cannot break behavior.

Could be something like this:

Pick<
  GridSlotProps['basePopper'],
  'id' | 'className' | 'target' | 'flip' | 'placement' | 'focusTrap'
>

For the on* handlers, maybe hold off for now. They are risky without a real example or doc showing how to compose them with the internal handlers. Keeping the fix small avoids advertising a footgun.

GridSlotProps['basePopper'],
'id' | 'className' | 'target' | 'flip'
> {
export interface GridPanelProps extends Omit<GridSlotProps['basePopper'], 'ref'> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(2) Minor: with this Omit, GridPanelProps now inherits a required open: boolean from PopperProps (gridBaseSlots.ts:211). So the open: boolean re-declaration on line 33 is identical and dead. Please drop that line.

onClose is not in PopperProps, so keep it.

-  open: boolean;
   onClose?: () => void;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: data grid Changes related to the data grid. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants